import instance from '@/utils/axios'

export function apiGetArticle (id) {
  return instance({
    url: '/app/v1_1/articles',
    method: 'get',
    params: {
      channel_id: id,
      timestamp: Date.now(),
      with_top: 0
    }
  })
}

// 对文章不感兴趣
export function dislikeArticle (artid) {
  return instance({
    url: '/app/v1_0/article/dislikes',
    method: 'POST',
    data: {
      target: artid
    }
  })
}

// 反馈辣鸡内容
export function reportArticle (artid, type) {
  return instance({
    url: '/app/v1_0/article/reports',
    method: 'POST',
    data: {
      target: artid,
      type: type,
      remark: ''
    }
  })
}

// 对文章点赞
export function apiLikeArticle (artid) {
  return instance({
    url: '/app/v1_0/article/likings',
    method: 'post',
    data: {
      target: artid
    }
  })
}

// 获取文章详情
export function apiGetDetail (artid) {
  return instance({
    url: `/app/v1_0/articles/${artid}`
  })
}

// 取消对文章点赞
export function apiCancelZan (artid) {
  return instance({
    url: `/app/v1_0/article/likings/${artid}`,
    method: 'DELETE'
  })
}

// 取消对文章不喜欢
export function apiCancelDislike (artid) {
  return instance({
    url: `/app/v1_0/article/dislikes/${artid}`,
    method: 'DELETE'
  })
}

// 对文章不喜欢
export function apiDislike (artid) {
  return instance({
    url: '/app/v1_0/article/dislikes',
    method: 'POST',
    data: {
      target: artid
    }
  })
}
